<?php
/**
 * Created by jinqiang on 2024/6/13 15:21.
 * Copyright (c) 2024, Your Company. All rights reserved.
 */


namespace App\Http\Repository;


class SzdptechRepository
{
    //获取款号图片信息
    public static function searchStyleImgs($numbers = [])
    {
        $url="https://kz.szdptech.com:18006/api/searchStyleImgsByNumber";
        if(empty($numbers)){
            return ['code' => -1, 'msg' => '请求内容为空'];
        }
        $param = [
            'headers' => ['Content-Type:application/json;charset=UTF-8'],
            'json' => json_encode($numbers)
        ];
        $res = httpCurl($url, $param);
        return json_decode($res, true);
    }

    //获取附件图片信息
    public static function searchStyleAttach($numbers = [])
    {
        $url = "https://kz.szdptech.com:18006/api/searchStyleAttach";
        if(empty($numbers)){
            return ['code' => -1, 'msg' => '请求内容为空'];
        }
        $param = [
            'headers' => ['Content-Type:application/json;charset=UTF-8'],
            'json' => json_encode($numbers)
        ];
        $res = httpCurl($url, $param);
        return json_decode($res, true);
    }

    //获取物料图片信息
    public static function searchMaterialImgs()
    {
        $url="https://kz.szdptech.com:18006/api/downLoadMaterialPic";
        $res = httpCurl($url, [], 'get');
        return json_decode($res, true);
    }

    //获取成品加工单列表
    public static function productSubcontractDetail($numbers)
    {
        $url="https://kz.szdptech.com:18006/api/productSubcontractDetail";
        $param = [
            'headers' => ['Content-Type:application/json;charset=UTF-8'],
            'json' => json_encode(["number" => $numbers])
        ];
        $res = httpCurl($url, $param);
        return json_decode($res, true);
    }

    //获取核价单数据
    public static function searchVerifyPrice($t73 = [], $numbers = [])
    {
        $jsonData = [
            'state' => [1],//锁定
            't73' => $t73 ?: ["实付核价"]
        ];
        if(!empty($numbers)){
            $jsonData['number'] = $numbers;
        }
        $url = "https://kz.szdptech.com:18006/api/searchVerifyPrice";
        $param = [
            'headers' => ['Content-Type:application/json;charset=UTF-8'],
            'json' => json_encode($jsonData, true)
        ];
        $res = httpCurl($url, $param);
        return json_decode($res, true);
    }
}
